cmake_minimum_required(VERSION 3.5)

set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS "-std=c++17")
#add_difinitions(-Wall -Werror)

# set(CMAKE_EXPORT_COMPILE_COMMANDS ON) 
project(serial)
find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
  geometry_msgs
  rm_interfaces
)

find_package(fmt REQUIRED)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES backend
#  CATKIN_DEPENDS roscpp std_msgs 
#  DEPENDS system_lib
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
)

set(SRC
  "src/transporter_driver/uart_transporter.cpp"
  "src/robot_base_node.cpp"
  "src/robot_base_main.cpp"
)

add_executable(simple_robot_base ${SRC})
add_dependencies(simple_robot_base ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(simple_robot_base configures_gencfg)
target_link_libraries(simple_robot_base 
  ${catkin_LIBRARIES}
  fmt::fmt
)

execute_process(COMMAND chmod a+x scripts/virtual_serial.py
        WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
        RESULT_VARIABLE cmd_result
        OUTPUT_VARIABLE cmd_ver)
